FROM php:7.3.21-fpm-alpine


RUN  apk update  &&  apk  add  git  vim   grep    unzip  

RUN  apk add  gcc  build-base  libjpeg  jpeg  jpeg-dev  librsvg  librsvg-dev  libwebp  libwebp-dev  libpng  libzip  libzip-dev  yasm \
     libxml2  libxml2-dev  openssl  openssl-dev  curl-dev  pcre-dev   autoconf  libevent icu  icu-dev  icu-libs  libidn2  libidn2-dev  libidn  libidn-dev \
     zlib-dev  libltdl  libx11   bzip2  bzip2-dev  dpkg  dpkg-dev  file   make   re2c  \
     libxext-dev  libxt-dev  libxml2-dev  ghostscript  fftw  fftw-dev   harfbuzz-dev \
     imagemagick6  imagemagick6-dev



RUN  mkdir -p /app/www
WORKDIR  /app/www

ENV  TIMEZONE=${timezone:-"Asia/Shanghai"}

## -j$(nproc) 意思是尽可能多的使用CPU核心数来进行编译
RUN  docker-php-ext-enable  opcache  \
     && docker-php-ext-configure  bcmath  && docker-php-ext-install -j$(nproc)   bcmath \
	 && docker-php-ext-configure  gd  --with-freetype-dir  --with-jpeg-dir  --with-webp-dir && docker-php-ext-install -j$(nproc)  gd \
	 && docker-php-ext-configure  pcntl  && docker-php-ext-install -j$(nproc)  pcntl  \
	 && docker-php-ext-configure  sockets  && docker-php-ext-install -j$(nproc)   sockets  \
	 && docker-php-ext-configure  sysvmsg  && docker-php-ext-install -j$(nproc)   sysvmsg  \
	 && docker-php-ext-configure  sysvsem  && docker-php-ext-install -j$(nproc)   sysvsem  \
	 && docker-php-ext-configure  sysvshm  && docker-php-ext-install -j$(nproc)   sysvshm  \
	 && docker-php-ext-configure  shmop  && docker-php-ext-install -j$(nproc)   shmop  \
	 && docker-php-ext-configure  zip  && docker-php-ext-install -j$(nproc)   zip  \
	 && docker-php-ext-configure  ftp  && docker-php-ext-install -j$(nproc)   ftp  \
	 && docker-php-ext-configure  soap  && docker-php-ext-install -j$(nproc)   soap  \
	 && docker-php-ext-configure  xml  && docker-php-ext-install -j$(nproc)   xml  \
	 && docker-php-ext-configure  exif  && docker-php-ext-install -j$(nproc)   exif  

RUN  pecl install  redis \
     && docker-php-ext-enable  redis \
     && pecl install  propro-2.1.0 \
     && pecl install  raphf-2.0.1 \
     && docker-php-ext-enable  raphf  propro \
	 && pecl install  imagick \
     && docker-php-ext-enable   imagick \
	 && pecl install  swoole-4.8.13 \
	 && docker-php-ext-enable   swoole  \
	 && echo "swoole.use_shortname = Off" >>  /usr/local/etc/php/conf.d/docker-php-ext-swoole.ini
	 




EXPOSE 9000


CMD ["php-fpm"]



##Windows
## docker  run --name  php  -p  9000:9000  -v  E:\www:/app/www  -d  php    挂载目录

##Linux
## docker  run --name  php  -p  9000:9000  -v  /app/www:/app/www  -d  php    挂载目录
